package com.chhh.cranelease.config;

import com.chhh.cranelease.exception.UseNotLoginException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;

import javax.servlet.http.HttpServletRequest;

@ControllerAdvice
public class UserExceptionHandler {

   @ExceptionHandler(UseNotLoginException.class)
    public String handlerException(Exception e, HttpServletRequest request){
        request.setAttribute("message","用户出错了");
        return "forward:/error";
   }
   @ExceptionHandler(NullPointerException.class)
    public String nullPointer(){
       return "forward:/error";
   }

}
